import { ref, computed } from 'vue'
import { createPinia, defineStore } from 'pinia'
import persist from 'pinia-plugin-persistedstate'

const pinia = createPinia()
pinia.use(persist)

export default pinia

export const useUserStore = defineStore('big-user', () => {
  const id = ref(0)
  const setID = (newToken: number) => {
    id.value = newToken
  }
  const removeID = () => {
    id.value = 0
  }

  return { id, setID, removeID }
})
